#ifndef _FIG_BONE_PART_H_
#define _FIG_BONE_PART_H_

#include "ui/ui_sprite.h"

class FIGBonePart
{			
public:
	


	FIGBonePart(int pID,
				const std::string& Name,
				float X,
				float Y,
				float Rotation);

	void				Init(const math::Vec2& Pos,
							float Rotation);	
	void				Reset();
	bool				Transform(float dt , const math::Vec2& Dest,const math::Vec2 Speed);
	bool				Transform(float dt , float RotationDest, float Speed);
 
	void				Tick(float dt);
	void				Render(const math::Vec2& Offset, float Scale, float Rotation, COLOR c);
	int					GetID() const { return m_ID; };

	const math::Vec2&	GetSize() const { return m_Sprite.m_SizeOriginal; };
	float				GetRotation() const { return m_Rotation; };
	void				SetRotation(float R); 
	void				SetPosition(const math::Vec2& Pos) { m_Pos = Pos; };
	const math::Vec2&	GetPosBackup() const { return m_PosBackup; };
	const math::Vec2&	GetPosition() const { return m_Pos; };
	float				GetRotationBackup() const { return m_RotationBackup; };
	void				Shoot(float Degree);
	
	void				AimToPlayer(	const math::Vec2& BonePos, 
										float Speed
										);
	void				SetShouldDraw(bool b) { m_bShouldDraw = b; };
	bool				HitTest(const math::Vec2& BonePos,const math::Vec2& Pos);
	void				CopyToBackup() { m_PosBackup = m_Pos; m_RotationBackup = m_Rotation; };
	bool				IsOkToExplode ()const {return m_IsOkToExplode; };


protected:
	
	int					m_ID;
	ui::UISprite		m_Sprite;
	math::Vec2			m_Pos;
	math::Vec2			m_PosBackup;
	float				m_Rotation;
	float				m_RotationBackup;
	float				m_InitialRotation;	
	math::Vec2			m_InitialPos;
	bool				m_bShouldDraw;
	bool				m_bInit;

	math::Vec2			m_PosBeforeShoot;
	float				m_PosResetCounterAfterShoot;
	bool				m_IsOkToExplode;

private:

	// hardcode function
	bool				IsOkToExplode(const std::string& BonePartName) const;
	
};

#endif	// _FIG_BONE_PART_H_
